home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
pascal
/
gsdbloo.exe
/
DEMOB006.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-02-24
|
2KB
|
74 lines
program DemoB006;
{------------------------------------------------------------------------------
DBase File Lister
Sample 6
Demo Program
Copyright (c) Richard F. Griffin
10 February 1992
102 Molded Stone Pl
Warner Robins, GA 31088
-------------------------------------------------------------
This program demonstrates how dBase files may be indexed using
Griffin Solutions units.
If the DEMOB1.DBF file does not exist, the program will display a
a message that the file was not found and to run DEMOB001 to make
the file.
The program initializes a dBase file object, opens the file, creates
an index on LASTNAME, assigns the index, , and proceeds to list
selected fields from each record in LASTNAME sequence.
-------------------------------------------------------------------------------}
uses
CRT,
DOS,
GS_Date,
GS_dBase,
GS_DBFld,
GS_FileH;
var
MyFile : GS_dBFld_Objt;
ftest : file;
begin
ClrScr;
if not GS_FileExists(ftest, 'DEMOB1.DBF') then
begin
writeln('File DEMOB1.DBF not found. Run DEMOB001 to create.');
halt;
end;
{The 'Real' example starts here}
MyFile.Init('DEMOB1'); {Initialize object using the dBase III}
{file DEMOB1. DBF Extension assumed}
MyFile.Open; {Open the object's file}
{use IndexTo to create the index}
{This is only needed the first time through}
{It can be commented out for future runs}
MyFile.IndexTo('DEMOB6','LASTNAME');
{Assign the index}
MyFile.Index('DEMOB6');
MyFile.GetRec(Top_Record); {Get the first record in the file}
while not MyFile.File_EOF do {Repeat until end-of-file}
begin
writeln(MyFile.FieldGet('LASTNAME'),' ',
MyFile.FieldGet('FIRSTNAME'),' ',
MyFile.FieldGet('BIRTHDATE'));
MyFile.GetRec(Next_Record); {Get the next sequential record}
end;
MyFile.Close;
write('Press any Key to continue:');
repeat until KeyPressed;
end.